import math
t = int(input())
for _ in range(t):
a, b, x = map(int, input().split())
if(a > b):
a, b = b, a
if(x > b):
print("NO")
elif(x == a or x == b):
print("YES")
else:
count = 0
gcd = math.gcd(a, b)
while(x <= a and a > gcd):
b_ = b
b = a
a = (b_ % a)
if(x > b):
print("NO")
elif(x == a or x == b):
print("YES")
elif((b - x) % a == 0):
print("YES")
else:
print("NO")
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;
const long long mod = 1000000007;
ll gcd (ll a, ll b) {return b==0 ? a : gcd(b, a%b);}
const unsigned gen_seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
#define all(c) (c).begin(),(c).end()
#define srt(c) sort(all(c))
#define srtrev(c) sort(all(c)); reverse(all(c))
#define forn(i, a, b) for(int i = a; i < b; i++)
#define read(x) scanf("%d", &x)
#define readv(x, n) vll x(n); forn(i,0,n) cin>>x[i]
#define outv(x) forn(i,0,x.size())cout <<x[i]<< " "; cout <<endl
#define yes cout <<"yes\n";
#define no cout <<"no\n";
#define pb push_back
#define mp make_pair
int solve (ll a , ll b , ll x ) {
if ( a==x||b==x ) return 1 ;
if ( a==0 ||b==0 ) return 0 ;
ll k = ( a-x )/b ;
ll q = a/b ;
if ( k>=0 && k*b == (a-x) ) return 1 ;
solve ( b , a%b , x ) ;
}
int main()
{
#ifdef LOCAL
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
int ta;
scanf("%d\n", &ta);
forn(ifa,0,ta) {
ll a , b , x ; cin>> a >>b>>x ;
if ( x >max (a, b )){
no ;continue;
}
if ( a<b ) swap(a, b ) ;
if ( solve ( a, b , x )){
yes ;
}else no ;
}
}
1294C - Product of Three Numbers | 749A - Bachgold Problem |
1486B - Eastern Exhibition | 1363A - Odd Selection |
131B - Opposites Attract | 490C - Hacking Cypher |
158B - Taxi | 41C - Email address |
1373D - Maximum Sum on Even Positions | 1574C - Slay the Dragon |
621A - Wet Shark and Odd and Even | 1395A - Boboniu Likes to Color Balls |
1637C - Andrew and Stones | 1334B - Middle Class |
260C - Balls and Boxes | 1554A - Cherry |
11B - Jumping Jack | 716A - Crazy Computer |
644A - Parliament of Berland | 1657C - Bracket Sequence Deletion |
1657B - XY Sequence | 1009A - Game Shopping |
1657A - Integer Moves | 230B - T-primes |
630A - Again Twenty Five | 1234D - Distinct Characters Queries |
1183A - Nearest Interesting Number | 1009E - Intercity Travelling |
1637B - MEX and Array | 224A - Parallelepiped |